<?php


namespace app\kirito\controller;


use think\Controller;
use think\Db;
use think\facade\Request;
use think\facade\Session;
use think\facade\Cache;

class T1 extends Controller {
	function f(){
		return view();
	}

	function f1(){
		return view();
	}

	function index(){
		if(Request::isGet()){
			$redis=new \Redis();
			$redis->connect('redis');
//			$this->assign('name1',$redis->hGet('zero','name1'));
//			$this->assign('name2',$redis->hGet('zero','name2'));
//			$this->assign('name3',$redis->hGet('zero','name3'));
			$this->assign('name1',$redis->Get('zero1'));
			$this->assign('name2',$redis->Get('zero2'));
			$this->assign('name3',$redis->Get('zero3'));
			return $this->fetch();
		}
	}

	function index1(){
		if(Request::isGet()){
			@$name1=$_REQUEST['name1'];
			@$name2=$_REQUEST['name2'];
			@$name3=$_REQUEST['name3'];
			$redis=new \Redis();
			$redis->connect('redis');
			$redis->Set('zero3',$name3);
			$redis->save();
			$redis->Set('zero1',$name1);
			$redis->save();
			$redis->Set('zero2',$name2);
			$redis->save();
			return json(['status'=>true]);
		}
	}

	function a(){
		Cache::store('redis')->set('name','value',3600);
		echo Cache::store('redis')->get('name');
	}

}